# coding:utf-8
from django.db import models
from django.contrib.auth.models import User


class user(models.Model):
    STUDENT = 0
    TEACHER = 1
    ADMIN = 2
    USERTYPE = {STUDENT: "学生", TEACHER: "老师", ADMIN: '管理员'}

    GROUPONE= 0
    GROUPTWO = 1
    GROUPTHERE= 2
    GROUPTYPE = {GROUPONE: "一年级", GROUPTWO: "二年级", GROUPTHERE: '三年级'}

    CLASSONE=0
    CLASSTWO=1
    CLASSTHERE=2
    CLASSFOUR=3
    CLASSFIVE=4
    CLASSSIX=5
    CLASSSEVEN=6
    CLASSENGHT=7
    CLASSNINE=8
    CLASSTEN=9
    CLASSNAME = {CLASSONE: "一班", CLASSTWO: "二班", CLASSTHERE: '三班', CLASSFOUR:"四班",CLASSFIVE:"五班",CLASSSIX:"六班",CLASSSEVEN:"七班",CLASSENGHT:"八班",CLASSNINE:"九班",CLASSTEN:"十班"}

    type = models.IntegerField(default=0, choices=USERTYPE.items(), verbose_name="用户类型")
    num = models.OneToOneField(User, verbose_name="学号")
    name = models.CharField(max_length=20, verbose_name="姓名")
    id_card = models.CharField(max_length=20, verbose_name="身份证号")
    group=models.IntegerField(choices=GROUPTYPE.items(), verbose_name="年级")
    classname=models.IntegerField( choices=CLASSNAME.items(), verbose_name="班级")
    phone = models.CharField(null=True, blank=True, max_length=20, verbose_name="联系方式")
    address = models.CharField(null=True, blank=True, max_length=100, verbose_name="地址")

    def __unicode__(self):
        return self.name
